ROUND (number)

Purpose

This function rounds number n to integer digits behind the decimal point (round to nearest, in case of a tie away of the zero).

Syntax

round (number)::=

Usage Notes

  • If the second argument is not specified, rounding is conducted to an integer.
  • If the second argument is negative, rounding is conducted to integer digits in front of the decimal point.
  • If the data type of n is DECIMAL(p, s) and the second argument is positive, then the result data type is DECIMAL(p, integer).
  • If the data type of n is DOUBLE, then the result data type is also DOUBLE. Due to the problem of representation for DOUBLE values, the result could contain numbers with more digits after the decimal point than you would expect because of the rounding. Therefore we recommend that you always cast the result to an appropriate DECIMAL data type.
  • For more information on the CEIL() and FLOOR() functions, see CEIL[ING] and FLOOR.

Example

SELECT ROUND(123.456,2) ROUND;